#include <stdio.h>
#include <stdlib.h>
#include "hls_stream.h"
#include "fir_1x.h"

using namespace hls;
const t_input_scalar coe[FIR_TAP_NUM] = {
//#include "hdlCoefs.txt"
#include "coef_68.txt"
};

void fir_1x ( const t_input_scalar& din,  t_output_scalar& dout)
{
#pragma HLS INTERFACE ap_none port=dout
#pragma HLS INTERFACE ap_none port=din
#pragma HLS PIPELINE II=1
#pragma HLS INTERFACE ap_ctrl_none port=return

	static t_output_scalar product1[FIR_TAP_NUM+1]={t_output_scalar(0)};
#pragma HLS ARRAY_PARTITION variable=product1 complete dim=1

	// output
	dout = product1[FIR_TAP_NUM];

	label_mulacc:
	for (int gv_i=0;gv_i<FIR_TAP_NUM;gv_i++)  {
#pragma HLS UNROLL
		product1[FIR_TAP_NUM-gv_i]  = din * coe[FIR_TAP_NUM-gv_i-1] + product1[FIR_TAP_NUM-gv_i-1];
	}

};
